// dlg.cpp : implementation file
//

#include "stdafx.h"
#include "consolemfc003.h"
#include "dlg.h"
#include "resource.h"


// dlg dialog

IMPLEMENT_DYNAMIC(dlg, CDialog)

dlg::dlg(CWnd* pParent /*=NULL*/)
	: CDialog(dlg::IDD, pParent)
{

}

dlg::~dlg()
{
}

void dlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(dlg, CDialog)
//	 ON_MESSAGE(DM_GETDEFID,OnGetDefID)

ON_MESSAGE(WM_MMSG_LMT_LOG,&dlg::OnMsgLMTLog)
ON_BN_CLICKED(IDOK, &dlg::OnBnClickedOk)
ON_BN_CLICKED(IDCANCEL, &dlg::OnBnClickedCancel)
END_MESSAGE_MAP()

LRESULT dlg::OnMsgLMTLog(WPARAM wp, LPARAM lp)     
{
	int nLine;
	nLine = (int)wp;
	printf("%d yes,yjj, waiting your command...\n",nLine);
	return 0;
}   



// dlg message handlers

void dlg::OnBnClickedOk()
{
	//char str_array[256];
	CEdit* cedit = (CEdit*)GetDlgItem(IDC_EDIT2);
//	ASSERT _VALID (cedit) ; 
	

	
	CString str;//=_T("yjj is a  good man\r\nyjj is a good man");
	
	GetDlgItemText(IDC_EDIT2,str);
	str.Append(_T("\r\n yjj is a good man"));
	SetDlgItemText(IDC_EDIT2,str);
	int nLine = cedit->GetLineCount();
	SendMessage(WM_MMSG_LMT_LOG,(WPARAM)nLine,0);
	cedit->LineScroll(nLine+1,0);
	printf("%d\n",nLine);
	
	// TODO: Add your control notification handler code here
	//OnOK();
}

void dlg::OnBnClickedCancel()
{
	// TODO: Add your control notification handler code here
	OnCancel();
}
